function [C]=BSpline_gen(vertices,n,k,NodeVector,accuracy,weights)

%n=size(veritces,1);
Nik_w=zeros(1,n);
if NodeVector(2)~=0&&NodeVector(end-1)~=1%均匀B样条
    offset=k/(n+k+1); %由于均匀B样条的性质，起始和结束的拟合效果不好，一般舍弃掉
else
    offset=0;
end

count=1;
C=zeros(2,int8((1-2*offset)/accuracy));
for u =0+offset : accuracy :1- offset-accuracy
    Dom=0;
    for i = 0 : 1 : n
        weights(i+1,1)
        Nik_w(1, i+1) = BaseFunction(i, k , u, NodeVector)*weights(i+1,1);
        Dom=Dom+Nik_w(1,1+i);
    end
    C(:,count)=  (Nik_w/Dom)*vertices;
    count=count+1;
end

end